'use strict';
module.exports = {
	/**
	 * 查询轮播图
	 * @url client/slideshow/pub/getList 前端调用的url参数地址
	 * data 请求参数 说明
	 * @param {String} client 客户端
	 * @param {String} place 显示位置
	 */
	main: async (event) => {
		let { data = {}, userInfo, util, filterResponse, originalParam } = event;
		let { customUtil, uniID, config, pubFun, vk, db, _ } = util;
		let { uid } = data;
		let res = { code: 0, msg: "" };
		// 业务逻辑开始-----------------------------------------------------------
		let { client, place } = data;
		
		let whereJson = {
			client: _.in([client]),
			place: _.in([place]),
			status: true
		};
		
		let dbName = "db-slideshow";
		
		res["data"] = await vk.baseDao.selects({
			dbName,
			getMain: true,
			whereJson,
			sortArr: [{name: "sort", type: "desc"}, {name: "_add_time", type: "desc"}],
			fieldJson: {
				client: false,
				place: false,
				sort: false,
				uid: false,
			}
		});

		// 业务逻辑结束-----------------------------------------------------------
		return res;
	}
}
